home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.1 / card_21362.txt < prev    next >
Text File  |  1989-02-26  |  6KB  |  148 lines

  1. -- card: 21362 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2612
  5. -- name: dispPict
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: 8003
  11. -- rect: left=330 top=237 right=265 bottom=454
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Display GrayView
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   if the optionkey is down then pass mouseup
  23.   put FileName("gray") into theFile
  24.   show the message box
  25.   if theFile is not empty then DispPICT thefile,1,1
  26.   put the result into pt
  27.   if pt is not empty then
  28.     if pt contains "ot" then
  29.       put pt into the message box
  30.     else if pt is "0,0" then
  31.       put "You didn't click on the picture" into the message
  32.     else
  33.       put "You last clicked at " into the message box
  34.       put pt after the message box
  35.     end if
  36.   end if
  37. end mouseUp
  38.  
  39.  
  40.  
  41. -- part 2 (button)
  42. -- low flags: 00
  43. -- high flags: 8003
  44. -- rect: left=330 top=267 right=295 bottom=455
  45. -- title width / last selected line: 0
  46. -- icon id / first selected line: 0 / 0
  47. -- text alignment: 1
  48. -- font id: 0
  49. -- text size: 12
  50. -- style flags: 0
  51. -- line height: 16
  52. -- part name: Display PICT
  53. ----- HyperTalk script -----
  54. on mouseUp
  55.   if the optionkey is down then pass mouseup
  56.   put FileName("PICT") into theFile
  57.   show the message box
  58.   if theFile is not empty then DispPICT thefile,1,1
  59.   put the result into pt
  60.   if pt is not empty then
  61.     if pt contains "ot" then
  62.       put pt into the message box
  63.     else if pt is "0,0" then
  64.       put "You didn't click on the picture" into the message
  65.     else
  66.       put "You last clicked at " into the message box
  67.       put pt after the message box
  68.     end if
  69.   end if
  70. end mouseUp
  71.  
  72.  
  73.  
  74. -- part 3 (button)
  75. -- low flags: 00
  76. -- high flags: A003
  77. -- rect: left=82 top=302 right=324 bottom=182
  78. -- title width / last selected line: 0
  79. -- icon id / first selected line: 0 / 0
  80. -- text alignment: 1
  81. -- font id: 0
  82. -- text size: 12
  83. -- style flags: 0
  84. -- line height: 16
  85. -- part name: Install
  86. ----- HyperTalk script -----
  87. on mouseUp
  88.   if the optionkey is down then pass mouseup
  89.   put installres(XCMD,dispPict) into it
  90.   if it is empty then play oops
  91.   else answer it
  92. end mouseUp
  93.  
  94.  
  95.  
  96. -- part contents for background part 13
  97. ----- text -----
  98. 17
  99.  
  100. -- part contents for background part 2
  101. ----- text -----
  102. dispPict
  103.  
  104. -- part contents for background part 3
  105. ----- text -----
  106.  
  107. This is a demo of the DispPICT XCMD for displaying color pictures on a Mac II.  The XCMD resource is inside this stack.  Move it to other stacks using ResEdit or a similar utility.  
  108.  
  109.  
  110. Only the fileName parameter is required.   It must be in quotes, however, and it must be a complete pathname.  DispPICT does not look in the Home stack to determine where to find documents.
  111.  
  112. "fileName" is the file you want to display.  DispPICT can display pictures of type 'PICT', such as those made with MacDraw, Cricket Draw, GrayView, etc. DispPICT can also show any file containing a PICT resource with ID = 0.  These files can be used as StartUpScreens and can be generated by several programs.
  113.  
  114. "windowing" is either 0 or 1.  If 1, DispPICT will show the picture in a moveable, resizeable, scrolling window with a zoom and goaway box.  If windowing = 0, the picture will be displayed in a fixed window with no borders, a sort of "Post-IT" picture.  It will be closed as soon as the user clicks the mouse on top of it.  The default is 0.
  115.  
  116. "bestColors" is either 0 or 1.  If 1, DispPICT will determine which colors are best suited for displaying the picture, and will use those.  This is useful for pictures with specialized color needs.  If 0, DispPICT will use the colors currently available on the Mac.  This is probably adequate for most pictures.  The default is 0.
  117.  
  118. "left" and "top" specify where the top left corner of the window will lie on the screen.  If left = top = 0, DispPICT will center the picture on the whole screen.  This is the default.
  119.  
  120. "right" and "bottom" specify the bottom right corner of the window.  If right = bottom = 0, or if top = bottom = 0, the values are ignored.  This is the default.
  121.  
  122. "delay" specifies the number of seconds you want to the picture to appear on the screen before going away automatically.  With this you can set up StartupScreens for stacks that let you continue after a brief pause.  The user can still close the window normally (via the goaway box if windowing = 1, or by click on the picture if windowing = 0) before "delay" seconds have passed.  If delay = 0 the window will stay up indefinitely.  This is the default.
  123.  
  124. "leftpixel," and "toppixel" allow you to specify what pixel of the actual picture should appear in the top left corner of the window.  If windowing = 1, it will look like the user already scrolled to that point. The default is leftpixel = toppixel = 0;
  125.  
  126. DispPICT also returns a value which HyperCard can access with "the result" function.  It specifies the pixel (in h,v coordinates) in the picture that the user lasted clicked on.  This allows HyperCard scripts to figure out what part of the photo someone chose, sort of like transparent buttons.  If there was no mouse click in the window, the returned value is 0,0.
  127.  
  128. SPECIAL NOTE:  Depending how much memory is available to HyperCard, DispPICT will use two different methods for scrolling when windowing = 1.  If there is surplus silicon, it will use an offscreen pixel map for maximum speed.  What this means to you is that scrolling will be very smooth.  However, if memory is low, DispPICT will not be able to do that trick, and scrolling will be substantially slower.  In particular, you can notice this effect by placing HyperCard in ever smaller MultiFinder partitions.
  129.  
  130. If any error occurs, DispPICT will beep once and return an error message.  The possible errors are "File not found," "Not enough memory," and "PICT could not be opened."
  131.  
  132. Please send any comments or bug reports to one of the following addresses.
  133.  
  134. David Fry
  135. 81 Irving Street
  136. Cambridge, MA   02138
  137.  
  138. CompuServe: 73317,1265
  139. GEnie:D.FRY
  140. ARPANET: fry@huma1.harvard.edu
  141. BITNET: fry@harvma1.bitnet
  142.  
  143. -- part contents for background part 10
  144. ----- text -----
  145. Syntax:
  146.  
  147. DispPICT fileName,windowing,bestColors,left,top,right,bottom,delay,leftpixel,toppixel
  148.